package com.py;

import java.util.Scanner;

public class ShuZu {
    public static void main(String[] args) {
        int [] a = new int[5];//定义长度
        Scanner sc = new Scanner(System.in);// 接受用户输入的内容
        for (int i = 0; i <a.length ; i++) {
            System.out.println("请输入第"+(i+1)+"个数字");
            a[i] = sc.nextInt();
        }
        System.out.println("输入的数字分别为：");
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]+" ");
        }
        int sum = 0;// 设置一个空盒子装数字
        for (int i = 0; i < a.length; i++) {
            // sum = sum+a[i];
            sum += a[i];
        }
        System.out.println("总和为："+sum);
    }
}
